#!/bin/bash

# Usage:
# Other bash script can involve this file by
# source functions.sh
# So that it can use the Colors and functions without defining them

# Colors
BLACK='\e[0;30m'
DARKGRAY='\e[1;30m'
BLUE='\e[0;34m'
LIGHTBLUE='\e[1;34m'
GREEN='\e[0;32m'
LIGHTGREEN='\e[1;32m'
CYAN='\e[0;36m'
LIGHTCYAN='\e[1;36m'
RED='\e[0;31m'
LIGHTRED='\e[1;31m'
PURPLE='\e[0;35m'
LIGHTPURPLE='\e[1;35m'
BROWN='\e[0;33m'
YELLOW='\e[1;33m'
LIGHTGRAY='\e[0;37m'
WHITE='\e[1;37m'
UNSETCOLOR='\e[m'
CERROR="$RED[ERROR]$UNSETCOLOR"
CINFO="$BROWN[INFO]$UNSETCOLOR"
CWARN="$LIGHTRED[WARN]$UNSETCOLOR"
CRUN="$BROWN[RUN]$UNSETCOLOR"

function die()
{
    echo -e "$CERROR $1" >&2
    exit ${2:-255}
}

# if script needs some cleaning work when program exits
# trap __finish EXIT
# __finish won't change the exit code
function __finish()
{
    echo -e "$CINFO[FIN] (Do cleaning work ...)"
}

_SOLUTION_BASENAME=solution
